Learn R Programming

dsld (version 0.2.2)

dsldFairML Wrappers: dsldFairML Wrappers

Description

Fair machine learning models: estimation and prediction. The following functions provide wrappers for some functions in the fairML package.

Usage

dsldFrrm(data, yName, sName, unfairness, definition = "sp-komiyama", 
   lambda = 0, save.auxiliary = FALSE)
dsldFgrrm(data, yName, sName, unfairness, definition = "sp-komiyama", 
   family = "binomial", lambda = 0, save.auxiliary = FALSE)
dsldNclm(data, yName, sName, unfairness, covfun = cov, lambda = 0, 
   save.auxiliary = FALSE)
dsldZlm(data, yName, sName, unfairness)
dsldZlrm(data, yName, sName, unfairness)

Value

An object of class 'dsldFairML', which includes the model information, yName, and sName.

Arguments

data

Data frame.

yName

Name of the response variable column.

sName

Name(s) of the sensitive attribute column(s).

unfairness

A number in (0, 1]. Degree of unfairness allowed in the model. A value (very near) 0 means the model is completely fair, while a value of 1 means the model is not constrained to be fair at all.

covfun

A function computing covariance matrices.

definition

Character string, the label of the definition of fairness. Currently either 'sp-komiyama', 'eo-komiyama' or 'if-berk'.

family

A character string, either 'gaussian' to fit linear regression, 'binomial' for logistic regression, 'poisson' for log-linear regression, 'cox' for Cox proportional hazards regression, or 'multinomial' for multinomial logistic regression.

lambda

Non-negative number, a ridge-regression penalty coefficient.

save.auxiliary

A logical value, whether to save the fitted values and the residuals of the auxiliary model that constructs the debiased predictors.

Author

S. Martha, A. Mittal, B. Ouattara, B. Zarate, J. Tran

Details

See documentation for the fairml package.

Examples

Run this code
# \donttest{
data(svcensus) 
data(compas1)

yName <- "wageinc"
sName <- "age"
frrmOut <- dsldFrrm(svcensus, yName, sName, 0.2, definition = "sp-komiyama") 
summary(frrmOut)
predict(frrmOut, svcensus[1:10,]) 

yName <- "two_year_recid"
sName <- "age"
fgrrmOut <- dsldFgrrm(compas1, yName, sName, 0.2, definition = "sp-komiyama")  
summary(fgrrmOut)
predict(fgrrmOut, compas1[c(1:10),]) 
# }

Run the code above in your browser using DataLab